﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Data;

namespace EntryExit
{
    public partial class DetailedReports : DevExpress.XtraReports.UI.XtraReport
    {
        public DetailedReports(string reportSubject, DataTable data)
        {
            InitializeComponent();
            ClearDataContext();

            lblRptHead.Text = reportSubject;
            if (data != null)
            {
                BindLabels(data);
            }
        }

        private void BindLabels(DataTable data)
        {
            data.DefaultView.Sort = "AuthorityName, Name";

            this.DataSource = data;
            GroupField grpbyName = new GroupField("Name");
            GroupHeader1.GroupFields.Add(grpbyName);
            XRBinding bindingName = new XRBinding("Text", data, "Name");
            XRBinding bindingTotalHrs = new XRBinding("Text", data, "TotalHours");
            XRBinding bindingSwipeIn = new XRBinding("Text", data, "SwipeIn");
            XRBinding bindingSwipeOut = new XRBinding("Text", data, "SwipeOut");
            XRBinding bindingDate = new XRBinding("Text", data, "Date");
            lblHeadName.DataBindings.Add(bindingName);
            lblDataTotalHrs.DataBindings.Add(bindingTotalHrs);
            lblDataSwipeIn.DataBindings.Add(bindingSwipeIn);
            lblDataSwipeOut.DataBindings.Add(bindingSwipeOut);
            lblDataDate.DataBindings.Add(bindingDate);
            
        }

    }
}
